<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul></ul>
    <button>委托</button>
    <script>
        var btn = document.querySelector('button')
        var ul = document.querySelector('ul')

        btn.addEventListener('click', function(e) {
            console.log(e.target);
            var p1 = document.createElement('p')
            p1.innerHTML = '新增一些段落'
            ul.appendChild(p1)

        })
        ul.addEventListener('click', function(a) {
            if (a.target.nodeName === "P") a.target.remove()

        })
    </script>
</body>

</html>